<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Platform Setting</title>
<meta content="no-cache" http-equiv="Pragma"> 
<meta http-equiv="X-UA-Compatible" content="IE=7"><meta http-equiv="Cache-Control"   content="no-cache">   <meta http-equiv="Expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<link rel="stylesheet" type="text/css" href="../web/pagestyle.css" />
<style type="text/css">
body{margin-top:5px;}
.nav
{
    height:50px;
    border:solid #87ceeb 1px;
    border-right:0;
    width:100px;
    background-color:#00CCFF;
    cursor:pointer;
    text-align:center;
    vertical-align:middle;
}
.tag
{
    background-color:#eee;
    border:solid #87ceeb 1px;
    border-left:0;
    display:none;
}
</style> 
<script>
    document.write("<script src='/cgi-bin/platform.cgi?n=" + Math.random() + "'></" + "script>");
</script>
<script src="../web/jquery-1.3.2.min.js"></script>
<script>
    function addMenu() {
        var menu = document.getElementById("menu");
        var container = document.getElementById("box");
        for (var i = 1; i <= platformNum; i++) {
            var o = document.createElement("li");
            $('.tab_box div:gt(0)').hide();
            if (i == 1) o.className = "selected";
            o.innerHTML = "Platform " + i;
            $(o).click(function () {
                $(this).addClass('selected').siblings().removeClass('selected');
                var index = $('.tab_menu li').index($(this));
                $('.tab_box div').eq(index).show().siblings().hide();
            }).hover(function () {
                $(this).addClass('hover');
            }, function () {
                $(this).removeClass('hover');
            });
            menu.appendChild(o);
        }
    }
    function addChild() {
        var container = document.getElementById("box");
        for (var i = 1; i <= platformNum; i++) {
            var o = document.createElement("div");
            var _tab = "";
            _tab = '<table width="100%" cellspacing="4">';
            _tab += '<tr><td style="width:40%" align="right">Platform Protocal:</td>';
            _tab += '<td><select name="protocol" class="select"><option value="0">Default</option><option value="1">CNC</option><option value="2">HX</option><option value="3">AL</option><option value="4">ZTE</option><option value="5">KEDCOM</option><option value="6">HW</option><option value="16">NONE</option></select></td></tr>';
            _tab += '<tr><td align="right">Device ID:</td><td><input type="text" name="devId" class="text"/></td></tr>';
            _tab += '<tr><td align="right">Http ADDR:</td><td><input type="text" name="regSrv" class="text"/><input type="text" name="srvPort" style="width:60px;margin-left:10px;" /></td></tr>';
            _tab += '<tr><td align="right">Http Password:</td><td><input type="text" name="pwd" class="text"/></td></tr>';
            
            _tab += '<tr><td align="right">Sip ADDR:</td><td><input type="text" name="sip1Srv" class="text"/><input type="text" name="sip1Port" style="width:60px;height:18px;margin-left:10px;" /></td></tr>';
            _tab += '<tr><td align="right">Sip2 ADDR:</td><td><input type="text" name="sip2Srv" class="text"/><input type="text" name="sip2Port" style="width:60px;height:18px;margin-left:10px;" /></td></tr>';
            
            _tab += '<tr><td align="right">HTTP HeartbeatEn:</td><td><input type="checkbox"  name="httpHeartEnabled"/></td></tr>';
            _tab += '<tr><td align="right">HTTP Heartbeat Period:</td><td><input type="text" name="httpHeartPeriod" class="text"/></td></tr>';
            _tab += '<tr><td align="right">SIP HeartbeatEn:</td><td><input type="checkbox" name="sipHeartEnabled"/></td></tr>';
            _tab += '<tr><td align="right">SIP Heartbeat Period:</td><td><input type="text" name="sipHeartPeriod" class="text"/></td></tr>';

            _tab += '<tr><td align="right">Alarm Server ADDR:</td><td><input type="text" name="alarmSrvIp" class="text"/><input type="text" name="alarmSrvPort" style="width:60px;height:18px;margin-left:10px;" /></td></tr>';
            
            _tab += '<tr><td align="right" height="20">&nbsp;</td></tr></table>';
            o.innerHTML = _tab;
            container.appendChild(o);
        }
    }

    function on_load() {
        addMenu();
        addChild();
        var form = document.form1;
        for (var i = 0; i < platformNum; i++) {
            form.protocol[i].value = platform[i][1];
            form.devId[i].value = platform[i][2];
            
            form.regSrv[i].value = platform[i][3]; 
            form.srvPort[i].value = platform[i][4];
            form.pwd[i].value = platform[i][5];
            
            form.sip1Srv[i].value = platform[i][6];
            form.sip1Port[i].value = platform[i][7];
            form.sip2Srv[i].value = platform[i][8];
            form.sip2Port[i].value = platform[i][9];            
            
            if (platform[i][10] == 1)
			{
				form.httpHeartEnabled[i].checked = "checked";
			}
			
            form.httpHeartPeriod[i].value = platform[i][11];
            if (platform[i][12] == 1) 
			{
				form.sipHeartEnabled[i].checked = "checked";
			}
			
            form.sipHeartPeriod[i].value = platform[i][13];
			
            form.alarmSrvIp[i].value = platform[i][14];
            form.alarmSrvPort[i].value = platform[i][15];
        }        
    }
</script>
<base target="_self"/>
</head>
<body onload="on_load()">
<form name="form1"  method="post" action='Platform'>
<div class="tab" style="width:100%;">
<div class="tab_menu" style="text-align:center">
<ul id="menu">
</ul>
</div>
<div class="tab_block" ></div>
<div class="tab_box" id="box" style="height:310px">
</div>
</div>
<div class="tab_block" ></div>
<br />
<div align="center"><table width="74" border="0" cellspacing="0" cellpadding="0"><tr><td height="18" class="TOPBG" onmouseover="this.className='TOPBGOVER';" onmouseout="this.className='TOPBG';" onclick="document.form1.submit();window.close();">OK</td></tr></table></div>
</form>
</body>
</html>
